package com.scala.spark.untypedOperation

import org.apache.spark.sql.SparkSession

object UntypedOperation {
    def main(args: Array[String]): Unit = {
        val spark = SparkSession.builder().appName("untyped").master("local").getOrCreate()
        import spark.implicits._
        import org.apache.spark.sql.functions._
        val employee=spark.read.json("employee")
        val department=spark.read.json("department")

        employee.where($"age">35)
            .join(department,$"depId"===$"id")
            .groupBy(department("name"),employee("gender"))
            .agg(avg((employee("salary"))))
            .show()
        employee.select("name","age").where($"age">29).show()
    }

}

























